package com.netease.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.UUID;

import org.apache.commons.lang3.StringUtils;

public class ShoppingCart implements Serializable{



	/**
	 * 
	 */
	private static final long serialVersionUID = -7912210307931490477L;

	private String id;
	
	private User user;
	private String commodityId;
	private String title;
	private String summary;
	private String content;
	private String picture;
	private int amount;
	private double price;
	private Date createTime;
	
	
	public ShoppingCart(Commodity c) {
		this.id = UUID.randomUUID().toString();
		this.user = null;
		this.commodityId = c.getId();
		this.title = c.getTitle();
		this.summary = c.getSummary();
		this.content = c.getContent();
		this.picture = c.getPicture();
		this.amount = 0;
		this.price = c.getPrice();
		this.createTime = c.getCreateTime();
	}
	
	public ShoppingCart() {
		
	}
	
	public String getId() {
		if (!StringUtils.isBlank(this.id))
		{
			return this.id;
		}
		return UUID.randomUUID().toString();
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getSummary() {
		return summary;
	}
	public void setSummary(String summary) {
		this.summary = summary;
	}
	

	
	

	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	
	
	public String getCommodityId() {
		return commodityId;
	}
	public void setCommodityId(String commodityId) {
		this.commodityId = commodityId;
	}
	public int getAmount() {
		return amount;
	}
	public void setAmount(int amount) {
		this.amount = amount;
	}
	public double getPrice() {
		return price;
	}
	public void setPrice(double price) {
		this.price = price;
	}

	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	public String getPicture() {
		return picture;
	}
	public void setPicture(String picture) {
		this.picture = picture;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
}